#include <iostream>
#include <vector>
using namespace std;
void sum_n(int start_num,int target,vector<int> &v,vector<int>& data)
{
    if(target == 0)
    {
        for(auto i:v)
            cout<<i<<" ";
        cout<<"\n";
    }
    //
    for(int i=start_num;i<data.size();i++)
    {
        v.push_back(data[i]);
        sum_n(start_num+1,target-i,v,data);
        v.pop_back();
    }
}
int main() {
    int n = 5;
    int m = 10;
    vector<int> data ={1,2,5,10};
    vector<int> result;
    sum_n(0,m,result,data);
    return 0;
}